'use strict';
let calculate_median = function(collection){
    var result=[];
    for(let i=0;i<collection.length;i++){
        if((i+1)%2==0)
        result.push(collection[i])
    }
    let len=result.length;
    if(len%2!=0) return result[Math.floor(len/2)]
    else return (result[Math.floor(len/2)]+result[Math.floor(len/2)-1])/2
};
module.exports = calculate_median;
